iconhelper: always ensure a stated pixbuf
authorCosimo Cecchi <cosimoc@gnome.org>
Sun, 4 Aug 2013 14:50:31 +0000 (16:50 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 14 Apr 2014 05:26:18 +0000 (22:26 -0700)
Even when we are set a pixbuf itself.

https://bugzilla.gnome.org/show_bug.cgi?id=726271

gtk/gtkiconhelper.c

index cda1e9976d3a6fcbfb57c7f8e5ba1f74b561ee86..1dc3ce6535bfd4ec8941f3e6c9712758f4964a2d 100644 (file)
@@ -388,6 +388,7 @@ ensure_pixbuf_at_size (GtkIconHelper   *self,
                        GtkStyleContext *context)
 {
   gint width, height;
+  GdkPixbuf *stated;
 
   if (!check_invalidate_pixbuf (self, context))
     return;
@@ -427,6 +428,10 @@ ensure_pixbuf_at_size (GtkIconHelper   *self,
 
   if (!self->priv->rendered_pixbuf)
     self->priv->rendered_pixbuf = g_object_ref (self->priv->orig_pixbuf);
+
+  stated = ensure_stated_pixbuf_from_pixbuf (self, context, self->priv->rendered_pixbuf);
+  g_object_unref (self->priv->rendered_pixbuf);
+  self->priv->rendered_pixbuf = stated;
 }
 
 GdkPixbuf *
@@ -545,7 +550,7 @@ ensure_surface_from_pixbuf (GtkIconHelper   *self,
                            GtkStyleContext *context)
 {
   gint width, height;
-  GdkPixbuf *pixbuf;
+  GdkPixbuf *pixbuf, *stated;
   int scale;
 
   if (!check_invalidate_surface (self, context))
@@ -585,6 +590,10 @@ ensure_surface_from_pixbuf (GtkIconHelper   *self,
       scale = self->priv->orig_pixbuf_scale;
     }
 
+  stated = ensure_stated_pixbuf_from_pixbuf (self, context, pixbuf);
+  g_object_unref (pixbuf);
+  pixbuf = stated;
+
   self->priv->rendered_surface_width = (gdk_pixbuf_get_width (pixbuf) + scale - 1) / scale;
   self->priv->rendered_surface_height = (gdk_pixbuf_get_height (pixbuf) + scale - 1) / scale;